package com.marchsoft.musicalstore.controller;


import com.marchsoft.musicalstore.entity.User;
import com.marchsoft.musicalstore.service.UserInfo;
import com.marchsoft.musicalstore.util.RequestToJson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 云
 * Date: 2019-11-22
 * Time: 19:36
 */
@RestController
@RequestMapping("/getUser")
public class GetUserCon {
    @Autowired
    UserInfo userInfo;

    //通过id获取个人的所有信息
    @RequestMapping("/getStuInfo")
    public RequestToJson getUserInfo(int id){
        User user=userInfo.getPerInfo(id);
        return new RequestToJson(0,"成功",user);
    }

    @RequestMapping("/updateInfo")
    public RequestToJson updInfo(String head_img, String nickName,String phone,String password,int id){
       User user= userInfo.update(head_img,nickName,phone,password,id);
        if(user!=null){
            return new RequestToJson(0,"成功",user);
        }
        return new RequestToJson(1,"失败");
    }
}
